package com.qsd.TeacherSystem.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import com.qsd.TeacherSystem.interceptor.TeacherInterceptor;

/**
 * @Description
 * @Author Esion
 * @Data 2020年6月20日
 */
@Configuration
public class WebConfig implements WebMvcConfigurer {

	@Override
	public void addViewControllers(ViewControllerRegistry registry) {
		registry.addViewController("").setViewName("forward:index");
	}

	@Override
	public void addInterceptors(InterceptorRegistry registry) {
		registry.addInterceptor(new TeacherInterceptor())
				.addPathPatterns("/**")
				.excludePathPatterns(
						"/login.html",
						"/register.html",
						"/teacher/login",
						"/teacher/register",
						"/bg.jpg"
						);
	}

}
